Updating GoLang on Ubuntu

This morning I wanted to update from go 1.10 to go 1.11.2. I am currently using ubuntu 18.04. These are the steps I took to update my system.

Go version 1.11.2

First update ubuntu.

sudo apt-get update
sudo apt-get -y upgrade

Downloaded latest go version, unpack and cleanup.

cd /tmp
wget https://dl.google.com/go/go1.11.2.linux-amd64.tar.gz
sudo tar -xvf go1.11.2.linux-amd64.tar.gz
rm go1.11.2.linux-amd64.tar.gz

Remove old go and replace with new go.

sudo rm -rf /usr/local/go
sudo mv go /usr/local

Update go paths and system path.

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

Update current shell with new paths.

source ~/.profile

Remove any symlinks that may be hanging around from older go versions.

sudo rm /usr/bin/go
sudo rm /usr/bin/gofmt

Good luck with your own setup.

Be kind, Steve

comments powered by Disqus